﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SWDataDB.BLL;
using SWDataDB.DAL;

public partial class search_details : System.Web.UI.Page
{
    public string str;
    public int Count=0;

    protected void Page_Load(object sender, EventArgs e)
    {
         
       str = Server.UrlDecode(Request.QueryString["kw"]); 
        bind();
    }
       
  


    /// <summary>
    /// 绑定数据
    /// </summary>
    public void bind()
    {
        DataSet ds = new DataSet();
        SWDataDB.DAL.ZLInfo ZLobj = new ZLInfo();
        ds = ZLobj.GetAllInfobyInput(str);


        if (ds != null && ds.Tables.Count >= 0 && ds.Tables[0].Rows.Count > 0)
        {
            Count = ds.Tables[0].Rows.Count;
            //GridView1.DataSource = ds; ;
            //GridView1.DataKeyNames = new string[] { "ID" };
            //GridView1.DataBind();
            //this.ddlCurrentPage.Items.Clear();
            //for (int i = 1; i <= this.GridView1.PageCount; i++)
            //{
            //    this.ddlCurrentPage.Items.Add(i.ToString());
            //}
            //this.ddlCurrentPage.SelectedIndex = this.GridView1.PageIndex;
             
            DataTable srdt = ds.Tables[0];
            DataView srdv = srdt.DefaultView;
            //对用于分页的类的引用
            PagedDataSource srds = new PagedDataSource();
            srds.DataSource = srdt.DefaultView;//设置数据源(DataTable类型)
            srds.AllowPaging = true;
            SRAspNetPager.RecordCount = srdv.Count;
            srds.CurrentPageIndex = SRAspNetPager.CurrentPageIndex - 1;
            srds.PageSize = SRAspNetPager.PageSize;
            SRRepeater.DataSource = srds;
            SRRepeater.DataBind();
             
        }
        else
        {
            ds = ZLobj.GetAllInfoWithSet();
            Count = ds.Tables[0].Rows.Count;
         
            DataTable srdt = ds.Tables[0];
            DataView srdv = srdt.DefaultView;
            //对用于分页的类的引用
            PagedDataSource srds = new PagedDataSource();
            srds.DataSource = srdt.DefaultView;//设置数据源(DataTable类型)
            srds.AllowPaging = true;
            SRAspNetPager.RecordCount = srdv.Count;
            srds.CurrentPageIndex = SRAspNetPager.CurrentPageIndex - 1;
            srds.PageSize = SRAspNetPager.PageSize;
            SRRepeater.DataSource = srds;
            SRRepeater.DataBind();
        }




        
       
    }

    protected void SRAspNetPager_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        SRAspNetPager.CurrentPageIndex = e.NewPageIndex;
        bind();
    }

    
    
}
